#ifndef OSMIO
#define OSMIO

#include <base\vec2i.h>
#include <libxml\xmlreader.h>
#include <geo\geoLocation.h>
#include <geo\track.h>

#include <stdio.h>
#include <string>
#include <vector>

#define MAX_STEP_SIZE 10

class osmio {

  std::vector<track<geoLocation> > tracks;
  std::vector<track<vec2i> > projected_tracks;
  std::vector<track<vec2i> > refined_tracks;
  std::vector<track<unsigned char> > encoded_tracks;

  geoLocation north_west;
  geoLocation south_east;

private:

  void streamFile(const char *filename);
  bool processNode(xmlTextReaderPtr reader);

public:

  bool open(std::string filename);
  void project(int level);
  void refine();
  void encode();

  std::vector<track<geoLocation> > &getTracks();
  std::vector<track<vec2i> > &getProjectedTracks();
  std::vector<track<vec2i> > &getRefinedTracks();
  std::vector<track<unsigned char> > &getEncodedTracks();

  geoLocation getNW();
  geoLocation getSE();

  osmio();
  ~osmio();
};

#endif